package com.xin.di.uav.applet.service.impl;

import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.xin.di.uav.applet.mapper.PaymentBillMapper;
import com.xin.di.uav.applet.resp.PaymentBillResp;
import com.xin.di.uav.applet.service.PaymentBillService;
import com.xin.di.uav.common.utils.BeanUtil;
import com.xin.di.uav.mapper.BillMapper;
import com.xin.di.uav.po.Bill;
import com.xin.di.uav.user.order.po.PaymentBillPO;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

@Service
public class PaymentBillServiceImpl implements PaymentBillService {


    @Autowired
    private BillMapper billMapper;


    @Value("${download.tmp.dir:/tmp/excel_export_}")
    private String tmpBaseDir;

    @Override
    public List<PaymentBillResp.Record> list(int page, int pageSize, String orderNo, Date startTime, Date endTime) {
        List<Bill> paymentBillPOS = billMapper.selectList(page, pageSize, orderNo, startTime, endTime);
        return BeanUtil.copyProperties(paymentBillPOS, PaymentBillResp.Record.class);
    }


}
